(ns
  com.marzhillstudios.molehill.test-config
  (:use [clojure.test]
     [com.marzhillstudios.molehill.config]
     [com.marzhillstudios.molehill.template]))

(hill-page :index-tmpl state
             nil)
(hill-page :feed-tmpl state
             nil)
(hill-page :entry-tmpl state
             nil)


(defsite test-site
         :site-name "foo site"
         :site-base-url "http://foo.com/"
         :site-template-dir "_tmpl"
         :site-index-dir ".index"
         :site-root "./"
         :index :index-tmpl
         :feed :feed-tmpl
         :entry :entry-tmpl)

(deftest test-defconfig
           (is (= (:site-name *site-config*)
                  "foo site"))
           (is (= (:site-root *site-config*)
                  "./"))
           (is (= (:site-base-url *site-config*)
                  "http://foo.com/"))
           (is (= (:site-index-dir *site-config*)
                  ".index"))
           (is (= (:site-template-dir *site-config*)
                  "_tmpl"))
           (is (= (:site-name test-site)
                  "foo site"))
           (is (= (:site-root test-site)
                  "./"))
           (is (= (:site-base-url test-site)
                  "http://foo.com/"))
           (is (= (:site-index-dir test-site)
                  ".index"))
           (is (= (:site-template-dir test-site)
                  "_tmpl")))

(deftest test-valid-conf?
         (is (not (valid-conf? {:site-name "foo site"})))
         (is (not (valid-conf? {:site-name "foo site"
                                :site-base-url "http://foo.com/"})))
         (is (not (valid-conf? {:site-name "foo site"
                                :site-base-url "http://foo.com/"
                                :site-template-dir "_tmpl"})))
         (is (not (valid-conf? {:site-name "foo site"
                                :site-base-url "http://foo.com/"
                                :site-index-dir ".index"
                                :site-template-dir "_tmpl"})))
         (is (valid-conf? test-site)))
